#include <stdio.h>
int main()
{
    int n,i,a,t1,t2;
    float score;
    while (scanf("%d",&n)!=EOF)
    {
        score=0;t1=0;t2=10000;
        for (i=0;i<n;i++)
        {
            scanf("%d",&a);
            score+=a;
            if (t2>a)t2=a;
            if (t1<a)t1=a;
        }
        score=score-t1-t2;
        printf("%.2f\n",score/(n-2));
    }
    return 0;
}
